@extends('layouts.layouts')
@section('title')
    <title>后台首页</title>
@endsection
@section('content')
    <link rel="stylesheet" href="/lib/layer/theme/default/layer.css"/>
    <script type="text/javascript" src="/lib/layer/layer.js"></script>
    <div class="content">

        <div class="main-content">

            <div class="main-content header">
                <div class="btn-group btn-group-lg" role="group" aria-label="...">

                    <a class="btn btn-default @if($aid == 1) active @endif" href="/activity/new/1.html" >活动一</a>
                    <a class="btn btn-default @if($aid == 2) active @endif"  href="/activity/new/2.html">活动二</a>
                    <a class="btn btn-default @if($aid == 3) active @endif" href="/activity/new/3.html">活动三</a>
                    <a class="btn btn-default @if($aid == 4) active @endif" href="/activity/new/4.html">活动四</a>
                    <a class="btn btn-default @if($aid == 5) active @endif" href="/activity/new/5.html">活动五</a>
                </div>
            </div>
            <div class="btn-toolbar list-toolbar">
                <form class="form-inline" action="" method="get">

                    <div class="form-group">
                        <input type="text" class="form-control" name="mobile" placeholder="电话" value="">
                    </div>
                    <button type="submit" class="btn btn-default">筛选</button>
                </form>
            </div>
            <div class="row">
                <div class="col-sm-12 col-md-12">
                    <div class="panel panel-default">
                        <?php
                             $count = DB::table("activity_sponsor")->where("aid",$aid)->count();
                             $count1 = DB::table("activity_sponsor")->where("aid",$aid)->where("is_get",1)->count();
                        ?>
                        <div class="panel-heading no-collapse">活动参与列表【已有({{$count}}人参加,有{{$count1}}人完成活动)】</div>
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>姓名</th>
                                <th>微信名称</th>
                                <th>电话</th>
                                <th>已邀请人数</th>
                                <th>是否领取成功</th>
                                <th>参加时间</th>
                            </tr>
                            </thead>
                            <tbody>
                                @if(count($activity) > 0)
                                    @foreach($activity as $k=>$v)
                                        <tr>
                                            <td>{{$k+1}}</td>
                                            <?php
                                                $data = DB::table("users")->where("id",$v->uid)->first();
                                                $share = DB::table("activity_team")->where("userid",$v->uid)->where("aid",$aid)->count();

                                            ?>
                                            <td>{{$data?$data->name:''}}</td>
                                            <td>{{$data?$data->nickname:''}}</td>
                                            <td>{{$data?$data->mobile:''}}</td>
                                            <td>{{$share}}</td>
                                            <td>@if($v->is_get == 1) 已领取 @else 未领取 @endif</td>
                                            <td>{{$v->created_at}}</td>

                                        </tr>
                                    @endforeach
                                @endif
                            </tbody>
                        </table>

                    </div>
                    {{ $activity->links() }}
                </div>
            </div>
          
        </div>
    </div>
  
@endsection